package OneAagin;

import javax.swing.*;
import java.time.LocalDate;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
import java.util.PrimitiveIterator;

public class LonginImpl implements ILogin{

    private LogObj logObj = new LogObj();


    @Override
    public boolean login(String user, String pwd) {
        LocalTime loginTime = LocalTime.now();
        String time = DateTimeFormatter.ofPattern("HH:mm:ss").format(loginTime);
        if (user.equals("张三")&&pwd.equals("123")){
            JOptionPane.showMessageDialog(null,"登录成功");
            logObj.writeLog(user+"  "+ time+"  "+"登录系统\n");
            return true;
        }

        JOptionPane.showMessageDialog(null,"登录失败");
        logObj.writeLog(user+"  "+ time +"  "+"企图登录系统\n");
        return false;
    }
}
